package business.manage.system.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import business.manage.system.dto.Menu;
import business.manage.system.service.MenuService;

@Controller
@RequestMapping("menu")
public class MenuController {
	@Autowired
	private MenuService menuService;
	@RequestMapping("/list")
	public String listMenu(Model model){
		try {
			List<Menu> list = menuService.listMenu();
			model.addAttribute("menuList", list);
			return "admin/left";
		} catch (Exception e) {
			return "error";
			// TODO: handle exception
		}
	}
	
	@RequestMapping("/head")
	public String toHead(){
		return "admin/head";
	}
	
	@RequestMapping("/main")
	public String toMain(){
		return "admin/main";
	}
}
